gdk: Add gdk_drag_drop_done
authorMatthias Clasen <mclasen@redhat.com>
Mon, 7 Dec 2015 20:07:13 +0000 (15:07 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 13 Dec 2015 15:39:43 +0000 (10:39 -0500)
This will allow us to move the drag cancel animation to GDK.
For now, it does nothing.

gdk/gdkdnd.c
gdk/gdkdnd.h
gdk/gdkdndprivate.h

index 8a4559e2861b55b441a454015f04ac055a675c36..30096302f321d95395e12407a040e4280e1b0d7e 100644 (file)
@@ -503,3 +503,27 @@ gdk_drag_context_set_hotspot (GdkDragContext *context,
   if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot)
     GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot (context, hot_x, hot_y);
 }
+
+/**
+ * gdk_drag_drop_done:
+ * @context: a #GdkDragContext
+ * @success: whether the drag was ultimatively successful
+ *
+ * Inform GDK if the drop ended successfully. Passing %FALSE
+ * for @success may trigger a drag cancellation animation.
+ *
+ * This function is called by the drag source, and should
+ * be the last call before dropping the reference to the
+ * @context.
+ *
+ * Since: 3.20
+ */
+void
+gdk_drag_drop_done (GdkDragContext *context,
+                    gboolean        success)
+{
+  g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+  if (GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done)
+    GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done (context, success);
+}
index 12a817fc753452c887d6c61c27da46631f726ecb..1aa5d070922eaa33a53802d0d9151de132e1cf69 100644 (file)
@@ -178,6 +178,10 @@ void            gdk_drag_abort       (GdkDragContext *context,
 GDK_AVAILABLE_IN_ALL
 gboolean        gdk_drag_drop_succeeded (GdkDragContext *context);
 
+GDK_AVAILABLE_IN_3_20
+void            gdk_drag_drop_done   (GdkDragContext *context,
+                                      gboolean        success);
+
 GDK_AVAILABLE_IN_3_20
 GdkWindow      *gdk_drag_context_get_drag_window (GdkDragContext *context);
 
index e8a163f7c8c99eb0284fa6fb47090b952c8fe389..fe2a95dfc758516599c0cc64d83e633d05bfb272 100644 (file)
@@ -66,6 +66,8 @@ struct _GdkDragContextClass {
   void        (*set_hotspot)   (GdkDragContext  *context,
                                 gint             hot_x,
                                 gint             hot_y);
+  void        (*drop_done)     (GdkDragContext   *context,
+                                gboolean          success);
 };
 
 struct _GdkDragContext {